import { Component, OnInit, Input } from '@angular/core';
import { AppGlobalService } from '../../shared/service/app-global.service';

@Component({
  selector: 'app-recommend-clientlist',
  templateUrl: './recommend-clientlist.component.html',
  styleUrls: ['./recommend-clientlist.component.scss'],
})
export class RecommendClientlistComponent implements OnInit {
  @Input() tagData: any;
  constructor(private appGlobalService: AppGlobalService) { }

  ngOnInit() {
    /*  console.log(JSON.stringify(this.tagData));*/
    this.tagData.data.data.forEach(element => {
      console.log(element.status.label)
      if (element.status.label === "未跟进") {
        element.status.stylestatus = "notfollow";
      } else if (element.status.label === "跟进中") {
        element.status.stylestatus = "following";
      } else if (element.status.label === "无意向") {
        element.status.stylestatus = "nointention";
      } else if (element.status.label === "已成交") {
        element.status.stylestatus = "traded";
      } else {
        element.status.stylestatus = "nullstyle";
      }
    });
  }
  // 点击每一项列表
  recommendclick(obj){
    if (obj) {
      const pageParams = {
        pageId: obj.target,
        params: obj.params,
        sessionId: localStorage.getItem('sessionId')
      };
      console.log(pageParams);
      this.appGlobalService.goToForward(pageParams);
    }
  }
  // 点击更多列表
  moreclick(obj){
    if (obj) {
      const pageParams = {
        pageId: obj.target,
        params: obj.params,
        sessionId: localStorage.getItem('sessionId')
      };
      console.log(pageParams);
      this.appGlobalService.goToForward(pageParams);
    }
  }
}
